# -*- coding:utf-8 -*-
#! python3

from facecat import *

gPaint = FCPaint() #创建绘图对象
gPaint.defaultUIStyle = "dark"
gPaint.useWebView = True

#消息循环
def WndProc(hwnd,msg,wParam,lParam):
	return WndProcDefault(gPaint,hwnd,msg,wParam,lParam)

#创建窗体
createMainWindow(gPaint, "facecat-py", WndProc)

#创建图层
div = FCView()
div.paint = gPaint
if div.paint.defaultUIStyle == "dark":
    div.backColor = "rgb(0,0,0)"
    div.borderColor = "rgb(100,100,100)"
    div.textColor = "rgb(255,255,255)"
elif div.paint.defaultUIStyle == "light":
    div.backColor = "rgb(255,255,255)"
    div.borderColor = "rgb(150,150,150)"
    div.textColor = "rgb(0,0,0)"

div.viewType = "div"
div.showHScrollBar = True
div.showVScrollBar = True
div.dock = "fill"
addView(div, gPaint)

pie = FCPie()
pie.size = FCSize(280,280)
pie.textColor = "rgb(255,255,255)"
addView(pie, div)

item1 = FCPieItem()
item1.text = "项目1"
item1.value = 100
item1.color = "rgb(255,0,0)"
pie.items.append(item1)

item2 = FCPieItem()
item2.text = "项目2"
item2.value = 80
item2.color = "rgb(0,255,0)"
pie.items.append(item2)

item3 = FCPieItem()
item3.text = "项目3"
item3.value = 50
item3.color = "rgb(255,255,0)"
pie.items.append(item3)

item4 = FCPieItem()
item4.text = "项目4"
item4.value = 30
item4.color = "rgb(255,0,255)"
pie.items.append(item4)

updateViewDefault(gPaint.views)
showWindow(gPaint)

